﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;

namespace WEEK10_LECTURE_DEMO
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string filePath = Server.MapPath("汽车.xml");
                XmlReader reader = XmlReader.Create(filePath);

                string s = "";

                while (reader.Read())
                {
                    //Response.Write("【Name】" + reader.Name
                    //               + "【Value】" + reader.Value
                    //               + "【NodeType】" + reader.NodeType
                    //               + "【Depth】" + reader.Depth
                    //               + "<br/>");


                    if (reader.Name == "车主" && reader.IsStartElement())
                    {
                        s = reader.GetAttribute("性别");
                    }
                }
                Response.Write(s);

                reader.Close();
            }
            catch (Exception exception)
            {
                Response.Write(exception.Message);
            }
        }
    }
}